Skip to content

Conversation

@ArBridgeman
Copy link
Collaborator

@ArBridgeman ArBridgeman commented Oct 13, 2025

closes #413

Checklist

Note: If any of the items in the checklist are not relevant to your PR, leave the box unchecked.

For any Pull Request

Is the following correct:

  • the title of the Pull Request?
  • the title of the corresponding issue?
  • there are no other open Pull Requests for the same update/change?
  • that the issue which this Pull Request fixes ("Fixes...") is mentioned?

When Changes Were Made

Did you:

  • update the changelog?
  • update the implementation?
  • check coverage and add tests: unit tests and, if relevant, integration tests?
  • update the User Guide & other documentation?
  • resolve any failing CI criteria (incl. Sonar quality gate)?

When Preparing a Release

Have you:

  • thought about version number (major, minor, patch)?
  • checked Exasol packages for updates and resolved open vulnerabilities, if easily possible?

* Add future=true to create_engine

* Switch to sqlalchemy 2.x

* Lower linting threshold to match change to sqlalchemy 2.0; we can address this separately

* Due to migration, switch dbapi to new import_dbapi

https://docs.sqlalchemy.org/en/20/core/internals.html#sqlalchemy.engine.default.DefaultDialect.import_dbapi

* Config no longer present in sqlalchemy.testing.fixtures but sqlalchemy.testing

* Remove future=true, as unneeded as on 2.x

This will also be deprecated and removed
https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine.params.future

* Remove implicit_returning as it's a legacy parameter that does nothing in 2.x

https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine.params.implicit_returning

* Remove test_update_rowcount_return_defaults as no longer present in sqlalchemy.testing.suite.RowCountTest

* Temporarily skip failing tests to investigate later

* Add line about documentation for dialects

* Simplify boolean logic

* Simplify if with early return

* Reinstate ArgSignatureTest which checks that all visit_XYZ() in :class:`_sql.Compiler` subclasses have **kw

* Simplify early return

https://github.com/sqlalchemy/sqlalchemy/blob/rel_2_0_43/lib/sqlalchemy/testing/suite/test_dialect.py#L51

* Update changelog and developer guide

* Fix skip to be more specific; this only affects pyodbc usage & is a new test from 2.x

* Simplify early return if statements
@ArBridgeman ArBridgeman changed the title Refactoring/623 started switch to sqlalchemy 2 (#625) develop/switch_to_sqlalchemy_2 (#625) Oct 13, 2025
@ArBridgeman ArBridgeman changed the title develop/switch_to_sqlalchemy_2 (#625) develop/413_switch_to_sqlalchemy_2 Oct 14, 2025
* Override visit_floordiv_binary in EXACompiler for Exasol

* Floor division with python method was added in 2.x
in sqlalchemy/sqlalchemy@6d589ff
* A default method is provided to handle, but Exasol does not fully
match this flag, so we override the affected method instead.

* Fix to not in and use format string

* Define ExaDecimal for pyodbc to resolve test

* With updated Decimal transformation for pyodbc double-check skipped tests, which work now

* Start debugging ComponentReflectionTest

- Explicitly skip test groups
- Fix define_reflected_tables

* Clean up ExaDecimal
ArBridgeman and others added 2 commits October 31, 2025 13:58
* Override single tests in ReturningGuardsTest which expect a certain exception from the calling service which is not true for websocket

* Fix typos and harmonize spelling

* Introduce _get_schema_replacement_string to consolidate schema definition

* Extend has_table to search for views; required for 2.x consistency in tests

https://docs.sqlalchemy.org/en/20/core/internals.html#sqlalchemy.engine.Dialect.has_table

* Extend method to verify table/view exists and if not raises error
and reactivate tests

With the ability to find views via has_table(), the API also wants
get_columns, get_pk_constraint, and get_foreign_keys to check
if the table in question exists at all, so a check with has_table
is used.

* Modify tests as now unknown schema.table pairs should raise exception

* Modify schema name to ensure UPPERCASE as input to Exasol DB tables is case sensitive

* Switch NumericTest to xfail for clearer intention and to verify that our expectation holds as opposed to skipping it, which gives no information
* Remove pyodbc and odbc comments from documents

* Remove pyodbc from code part 1

* Make comment general after removing pyodbc

* Remove skip related to pyodbc; as tests should be ok to run now

* Remove override due to pyodbc

* Remove EXAODBC from connection string for websocket

* Add to documentation per:
Implicit autocommit was removed in SQLAlchemy 2.0. Use the .begin() method of Engine or Connection in order to use an explicit transaction for DML and DDL statements. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)

* Modify regression test to websocket, the remaining dialect variant

* Drop support for pyodbc with changelog entry

* With 2.0, we do not need the plugin

* Add typing hint for colspec to resolve base.py mypy error

* Remove older comment as not restricted anymore to pytest <6

* Remove odbc installation instructions for Ubuntu and ODBC usage

* Switch to websocket, as last remaining dialect

* Remove ODBC skip as no longer relevant; restore default test as override not needed; mark added test

* With pyodbc removal, linting dropped to 4.9. Should create ticket to bring back up

* Update slow tests to separately run sqla, exasol, & regression tests to make debugging easier in future

* Fix test to reduced state with only websocket still

* Without ODBC dialects, there is no longer a use_sql_fallback argument. Thus, test_compare_get_schema_names_for_sql_and_odbc is obsolete, as covered by test_get_schema_names

* Without ODBC dialects, there is no longer a use_sql_fallback argument. Thus, test_compare_get_table_names_for_sql_and_odbc is obsolete, as covered by test_get_table_names

* Without ODBC dialects, there is no longer a use_sql_fallback argument.
Thus, test_has_table_table_exists and test_has_table_table_exists_not can be simplified
and test_compare_has_table_for_sql_and_odbc can be removed.

* Without ODBC dialects, there is no longer a use_sql_fallback argument. Thus, these tests can be simplified

* Without ODBC dialects, there is no longer a use_sql_fallback argument. Thus, these tests can be removed for test_get_view_names and test_get_view_definition already cover

* Without ODBC dialects, there is no longer a use_sql_fallback argument. Thus, these tests can be simplified.

* Without ODBC dialects, there is no longer a use_sql_fallback argument.
Thus, these tests can be dropped as covered by test_get_columns,
test_get_foreign_keys, test_get_pk_constraint

* Remove comment with ODBC mention

* Reduce tests as sql_fallback does not exist now that ODBC-based dialects are gone

* Switch from skip in requirements.py to xfail in the tests

* Start collecting recurring issues in XfailRationale class

- Switch to Xfail with strict=True so that changes in state are obvious, i.e. failed test suite
- Stop overriding DifficultParametersTest as found all tests pass now

* Collect more recurring issues in XfailRationale class

- Switch from EXPLICIT_INDEX to MANUAL_INDEX
- ExpandingBoundInTest.test_null_in_empty_set_is_false is not a valid test anymore; this highlights the importance of using super() and XFAIL

* Finish moving skips to xfails

* Re-add test with modifications as only 1 still fails for <= 7.1.30

* Turn off autocommit in the connection for rollback to work

* Add change to README.rst per review comment

* Add changes to test_suite.py per review comments

* Add change to unreleased.md per review comment

* Add change to developer_guide.rst per review comment

* Add change to user_guide.rst per review comment

* Move user_guide into its own directory as will expand in future and rename
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support SQLAlchemy 2

2 participants